x = int(input("Value: "))
CC = int(input("CC: "))


binary = ''

while x%CC != 0:
    binary += str(x%CC)
    x //= CC
           
print(binary[::-1])
